home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 33R1
/
Commodore_Free_Issue_33R1_2009_Commodore_Computer_Club.d64
/
c16+4 pages
< prev
next >
Wrap
Text File
|
2023-02-26
|
7KB
|
255 lines
.
*************************************
Commodore 16 and plus 4 pages
Created By John Fielden
*************************************
Hi. c16 fans. Apologies, if I've
missed a month or so. It seems
everything piles up all at once..
For those wondering how long I may be
around. Subject to the editors kind
hospitality, and health permitting I
hope to eventually demonstrate that
some programs for other formats such
as The Amiga and beyond can work on
the c16/plus4.
(COMMODORE FREE you are welcome here
and I look forward to other
programming excursions')
Before we start with the essential
debugging.
It is important to note that the
extremely long program called
"Business Calculator" will work on a
genuine Commodore16. But you might
need to strip away the non-essentials
to preserve memory when saving. Like
the many lines of instructions that
aren't needed as you already have
them in the magazine! You can change
the border colour control to lose the
menu, and instead of up and down
controls. Just have it going one way
when the user presses 'c', and
resetting at the upper bound to the
lowest legal number -or, vice versa,
if you prefer. The last main change
I can think of is to take out the
first program. "VAT Calculator". To
give some assistance with this I have
included as a stand alone programme
for this months feast, Though it may
vary slightly. You already have the
original accompanying notes, So even
the most inexperienced novice should
be ok.
Having said all that.
Both programmes should work on the
other commodore 8bit formats like
VIC-20 or C=64 as there are no POKE
or PEEK commands. In fact, the only
stumbling block I can see is The
"SCNCLR" command, which means Screen
Clear. And can be changed to PRINT"
and then press shift and CLR HME key
". On other formats this may convert
to CLS.
Debugging
In order to keep enjoying something;
It is important to take the time to
play. In fact if something is new
then 70 or even 80 percent of the
time with it should be spent on
little else. In theory, the more
time you spend with something the
better you get. Of course learning
to get things right first time is
preferential, if you can manage to.
But often the best programmers are
those who learned to deal with
getting it wrong. (So, I must fast
becoming some kind of
"Guru"...Any-one seen the film???
-enough of that!)
The other day I saw fit to purchase a
newer computer. (new to me at least).
In the process, I decided to play
around with YAPE, the c16/plus4
emulator for windows PCs. available
through www.commodore16.com And so
having copied it across wrote the
following:-
10 FORJ=0TO20
20 COLOR0,,J
30 NEXT J
First, it is worth noting in line 30.
The 'J' is optional. But it is good
programming practice to have it in as
it makes the program easier to read.
Second, the response I got on typing
RUN was as follows:-
SYNTAX ERROR IN 20
It became obvious there are two
commas, where there should be only
one. So corrected this; and just
assuming that was it, I again typed
RUN.
Still the above. error
The program still being on screen, I
could see that "colour" is spelt how
the computer likes it. So I typed
PRINT J
Producing the answer 0.
typing HELP still brought the
insistence that line 20 is somehow
wrong. I've checked spelling, and
corrected typos. The 0, is a valid
command in the line. i.e. ...0,J So
what is wrong?
Try changing line 10 ...J=1 to...
You'll see the effect. Try adding
25 fork=1to350:nextk
you might add after that
:PrintJ
I still got the error message
ILLEGAL QUANTITY ERROR IN 20
To find why type
print j
We find the value of the variable 'j'
and see it must be over. So change
line 10 where it says ...20 to the
value one less from the computers
complaining and whining on.
(Honestly! Computers are soooo
clever you'd think they'd be able to
correct little things like this
themselves! NOPE.)
A useful program for finding the
colour, or combinations you like
best. Try adding a random element,
and a line for colour 4,l The border.
You might go through all the
combinations of the background with
one border colour. Before moving to
the next. If you need help with such
a program, let me know.
More fun (or "messing about" if you
wish to be critical) brought about
this program. Try to work out what
is wrong before looking at the
answers. A nice easy one.
10 PRINT"JOHN",X
20 IF X=4 THEN END
30 FOR X=1 TO 9
40 GOTO10
50 NEXT X
Questions
Try working out what will happen,
before typing RUN. if you guess
correctly, you won't need the answers
below:-
What is the absolute unnecessary line
in the listing?
How should the program list?
Answers.
Type RUN to see if you were correct.
You don't need the goto statement, if
you're line order is correct.
The correct order is:-
10 should be 20, 30 should be 10,
while what was 20 (ifx=4...) fits at
30. Either delete 40, or put REM in
front of it, and leave it intact as a
reminder of the folly of trying to be
clever with coding.
Programs This month
We've covered VAT Calc. already.
Tally Counter: Have you ever been in
a situation where you need to quickly
make and remember a count of
something, or even multiple things.
This program saves paper, even with
the cleverly devised system of 4 1s,
followed by a strikethrough for 5.
In case you don't know what this is;
"GraphicTally" is designed to show
you. But, please don't expect too
many graphic programs as I am by no
means competent at drawing.
GraphicTally: An interesting
demonstration of the tally mark as it
is/was used on paper. Of course the
above program may reduce such a need.
It's still useful to know, if you
didn't already. The program has the
added benefit of helping to
understand the plotting of graphics.
And there is a way to write the
program using loops and maths and
reducing program size, but as it does
less to show the plotting, was less
appealing for this exercise. If you
key in lines from 2000 early, you can
run the program after about line 50
every two or three lines to get a
feel for the progress.
Finally, the first version didn't
save! The pains I've been through.
If you saw the amount of error
corrections I had to do. You might
become a genius overnight! This skill
will come in advancing the program.
To give you an idea; try making an
educational program for young
children. Timing how fast they can
count a random number of tallys
appearing on screen. And even make a
competition with two or more players.
(I may print this in a future
edition, but see how you go, as it
will show how there are different
ways of doing the same thing).
Happy Programming
Jn.
=====================================